C# هي لغة برمجة قوية ومتعددة الاستخدامات طورتها Microsoft. تُستخدم في تطوير تطبيقات الويب، تطبيقات سطح المكتب، والألعاب. في هذه الدورة، سنتعرف على أساسيات C# مع أمثلة عملية.
                                    using System;
                                    class Program
                                    {
                                        static void Main()
                                        {
                                            Console.WriteLine("مرحبًا بالعالم!");
                                        }
                                    }
                                
                            
                                    int age = 25;
                                    string name = "علي";
                                    bool isStudent = true;
                                
                            
                                    string input = "123";
                                    int number = int.Parse(input);
                                
                            
                                    int score = 85;
                                    if (score >= 90)
                                    {
                                        Console.WriteLine("ممتاز!");
                                    }
                                    else if (score >= 75)
                                    {
                                        Console.WriteLine("جيد جدًا");
                                    }
                                    else
                                    {
                                        Console.WriteLine("حاول مرة أخرى!");
                                    }
                                
                            
                                    for (int i = 0; i < 5; i++)
                                    {
                                        Console.WriteLine("الرقم: " + i);
                                    }
                                
                            
                                    int[] numbers = { 1, 2, 3, 4, 5 };
                                    Console.WriteLine(numbers[0]); // Output: 1
                                
                            
                                    List<string> names = new List<string>();
                                    names.Add("علي");
                                    names.Add("سارة");
                                    Console.WriteLine(names[0]); // Output: علي
                                
                            
                                    static void Greet(string name)
                                    {
                                        Console.WriteLine("مرحبًا، " + name);
                                    }
                                    Greet("علي"); // Output: مرحبًا، علي
                                
                            
                                    static int Add(int x, int y)
                                    {
                                        return x + y;
                                    }
                                    int result = Add(5, 10); // result = 15
                                
                            
                                    class Person
                                    {
                                        public string Name;
                                        public int Age;
                                        public void DisplayInfo()
                                        {
                                            Console.WriteLine($"الاسم: {Name}, العمر: {Age}");
                                        }
                                    }
                                    Person person = new Person();
                                    person.Name = "علي";
                                    person.Age = 25;
                                    person.DisplayInfo(); // Output: الاسم: علي, العمر: 25
                                
                            
                                    class Student : Person
                                    {
                                        public string Major;
                                        public void DisplayMajor()
                                        {
                                            Console.WriteLine("التخصص: " + Major);
                                        }
                                    }
                                
                            
                                    string text = File.ReadAllText("file.txt");
                                    Console.WriteLine(text);
                                
                            
                                    File.WriteAllText("file.txt", "مرحبًا بالعالم!");
                                
                            
                                    try
                                    {
                                        int result = 10 / 0;
                                    }
                                    catch (Exception ex)
                                    {
                                        Console.WriteLine("حدث خطأ: " + ex.Message);
                                    }